feat: validate configuration with arktype#806
Merged
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR introduces configuration validation using arktype to improve the robustness of the configuration input. Key changes include:
- Moving and refining the definition of configuration types from types.ts to a new schema.ts.
- Integrating arktype validation in the build process with appropriate error handling.
- Adjusting target option parsing and related imports to align with the new schema.
Reviewed Changes
Copilot reviewed 8 out of 9 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| packages/react-native-builder-bob/src/utils/workerize.ts | Updated Target type import for consistency with the new schema. |
| packages/react-native-builder-bob/src/utils/loadConfig.ts | Refactored loadConfig function signature for clarity. |
| packages/react-native-builder-bob/src/types.ts | Removed obsolete Target and Options types moved to the schema. |
| packages/react-native-builder-bob/src/targets/codegen/index.ts | Updated Options type to exclude output for codegen targets. |
| packages/react-native-builder-bob/src/schema.ts | Introduced configuration schema using arktype. |
| packages/react-native-builder-bob/src/index.ts | Adjusted Target type import to use the new schema. |
| packages/react-native-builder-bob/src/build.ts | Integrated arktype validation and refined target option parsing. |
Files not reviewed (1)
- packages/react-native-builder-bob/package.json: Language not supported
Comments suppressed due to low confidence (2)
packages/react-native-builder-bob/src/schema.ts:1
- [nitpick] Consider renaming the imported identifier 'type' (e.g. to 'arktype') to avoid potential confusion with TypeScript's 'type' keyword and improve code clarity.
import { type } from 'arktype';
packages/react-native-builder-bob/src/build.ts:110
- [nitpick] Consider explicitly handling the case where no target-specific options are found rather than relying solely on a type cast, which may lead to unexpected behavior at runtime.
const options = config.targets.map((t) => (Array.isArray(t) ? t : ([t, undefined] as const))).find((t) => t[0] === target)?.[1];
f42468f to
b43ff30
Compare
f3ff47f to
ee1d7e8
Compare
ee1d7e8 to
fe258be
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.